package com.cgc.venus.server.app.inter;

import com.cgc.venus.server.app.bean.ConfigMapBean;
import com.cgc.venus.server.core.exception.VenusException;

import java.util.List;
import java.util.Map;

/**
 * Created by xyr on 2017/9/20.
 * 用户中心-服务配置,控制层接口
 */
public interface AppConfigService {

    /*
    * 获得所有命名空间,填充下拉框
    * */
    List<Map<String,Object>> getAllNamespace() throws VenusException;

    /*
    * 根据用户ID,获得命名空间,填充下拉框
    * */
    List<Map<String,Object>> getAllNamespaceByUser(String userId) throws VenusException;

    /*
    * 判断当前用户是否超级用户
    * */
    int isSuperAdmin(String userId) throws VenusException;

    /*
    * 1: 获取配置组数据,根据命名空间
    * */
    List<ConfigMapBean> getConfigMap(String namespace) throws VenusException;

    /*
    * 2: 创建新的配置组,根据空间名称,配置组名称
    * */
    boolean addConfigMap(String namespace,String configMapName) throws VenusException;

    /*
    * 3: 删除单个配置组,根据空间名,配置组名
    * */
    boolean deleteConfigMap(String namespace,String configMapName) throws VenusException;

    /*
    * 判断同一空间下是否存在相同的配置组
    * */
    boolean validateConfigMap(String namespace,String configMapName) throws VenusException;

    /*
    * 判断同一个配置组下面是否存在相同的配置文件
    * */
    boolean validateConfigFile(String namespace,String configMapName,String fileName) throws VenusException;

    /*
    * 5: 新增配置文件
    * */
    boolean addConfigFile(String namespace,String configMapName,String fileName,String fileContent) throws VenusException;

    /*
    * 6: 获取配置文件列表
    * */
    List<ConfigMapBean> getConfigFile(String namespace,String configMapName) throws VenusException;

    /*
    * 7: 删除单个配置文件
    * */
    boolean deleteConfigFile(String namespace,String configMapName,String fileName) throws VenusException;


}
